// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial


AnimatedObject := Rectangle {
    property <int> animated_prop;
    animate animated_prop { duration: aa_duration; }
    property <duration> aa_duration: 1s;
}

NotAnimatedObject := Rectangle {
    property <int> value;
    property <int> animated_prop: value;
}

TestCase := Rectangle {
    property <int> value : 1000;
    property <int> o1_val: o1.animated_prop;
    property <int> o2_val: o2.animated_prop;
    property <int> o3_val: o3.animated_prop;
    property <int> o4_val: o4.animated_prop;
    o1 := AnimatedObject {
        animated_prop: value;
    }
    o2 := AnimatedObject {
        aa_duration: 2s;
        animated_prop: value;
    }
    o3 := AnimatedObject {
        animate animated_prop { duration: 3s; }
        animated_prop: value;
    }
    o4 := NotAnimatedObject {
        value: root.value;
        animate animated_prop { duration: 4s; }
    }
}


/*

```rust
let instance = TestCase::new().unwrap();
assert_eq!(instance.get_o1_val(), 1000, "o1");
assert_eq!(instance.get_o2_val(), 1000, "o2");
assert_eq!(instance.get_o3_val(), 1000, "o3");
assert_eq!(instance.get_o4_val(), 1000, "o4");
instance.set_value(1600);
// animation not started
assert_eq!(instance.get_o1_val(), 1000, "o1 - 0");
assert_eq!(instance.get_o2_val(), 1000, "o2 - 0");
assert_eq!(instance.get_o3_val(), 1000, "o3 - 0");
assert_eq!(instance.get_o4_val(), 1000, "o4 - 0");


slint_testing::mock_elapsed_time(1000); // 1s
assert_eq!(instance.get_o1_val(), 1000 + 600, "o1 - 1"); // done
assert_eq!(instance.get_o2_val(), 1000 + 600/2, "o2 - 1"); // ½
assert_eq!(instance.get_o3_val(), 1000 + 600/3, "o3 - 1"); // ⅓
assert_eq!(instance.get_o4_val(), 1000 + 600/4, "o4 - 1"); // ¼

slint_testing::mock_elapsed_time(1000);
assert_eq!(instance.get_o1_val(), 1600, "o1 - 2");
assert_eq!(instance.get_o2_val(), 1600, "o2 - 2");
assert_eq!(instance.get_o3_val(), 1000 + 2*600/3, "o3 - 2");
assert_eq!(instance.get_o4_val(), 1000 + 600/2, "o4 - 2");

slint_testing::mock_elapsed_time(1000);
assert_eq!(instance.get_o1_val(), 1600, "o1 - 3");
assert_eq!(instance.get_o2_val(), 1600, "o2 - 3");
assert_eq!(instance.get_o3_val(), 1600, "o3 - 3");
assert_eq!(instance.get_o4_val(), 1000 + 3*600/4, "o4 - 3");


slint_testing::mock_elapsed_time(1000);
assert_eq!(instance.get_o1_val(), 1600, "o1 - 4");
assert_eq!(instance.get_o2_val(), 1600, "o2 - 4");
assert_eq!(instance.get_o3_val(), 1600, "o3 - 4");
assert_eq!(instance.get_o4_val(), 1600, "o4 - 4");

```

*/
